

let page = 0
async function renderPage() {
    page++
    let str = ''
    let params = {
        id: 1,
        page
    }
    let { data } = await getData('v1/content/type/list', params, 'dgmxgkvRVZg+WaDX0YdMU6N6CO/H3U7PGly02rBHH2bEFuyNWMSAdgJO0KRdK/Zo+pPjD9Ubw81bfDzMG3Qhqg==')

    data.data.contentsList.forEach((ele) => {
        console.log(ele)
        str +=
            `
            <div class="article-bigbox">
                <div class="article-item">
                    <a href="" class="item-website">
                        <div class="item-head">
                            <img src="${ele.relatedTopics[0].topicIcon}"
                                alt="">
                            <div class="item-news">${ele.tag[0]}</div>
                            <div class="item-time">${ele.createTime}</div>
                        </div>
                    </a>
                </div>
                <div class="article-box">
                    <div class="article-cover">
                        <img src="${ele.smallImages[0]}"
                            alt="">
                    </div>
                    <div class="article-text" data-text="${ele.tid}">
                            <div class="text-title">  ${ele.title}</div>
                            <div class="text-outline"> ${ele.intro}</div>
                        <div class="article-count">
                            <div class="view-count">${ele.praisedCount}</div>
                            <div class="comment-count">${ele.commentsCount} </div>
                            <div class="applause-count">${ele.viewsCount}</div>
                        </div>
                    </div>
                </div>
            </div>
             `
    })
    $('.index-page').append(str)
}
renderPage()
let _load = true
window.addEventListener('scroll', function () {
    // 检查是否滚动到页面底部
    if (document.documentElement.scrollTop + window.innerHeight >= document.documentElement.scrollHeight - 100 && _load) {
        // 在此处加载更多内容
        renderPage()
        setTimeout(() => {
            _load = true;
        }, 2500);
        _load = false;
    }
});